home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Plug-In Power Pack for Netscape Communicator
/
Plug-In Power Pack for Netscape Communicator.iso
/
plugins
/
dataviews
/
include
/
std.h
< prev
next >
Wrap
C/C++ Source or Header
|
1997-05-08
|
10KB
|
423 lines
/* file -- std.h
|======================================================================
|
| @(#)std.h V2.109
|
| copyright (c) 1988-92, V.I. Corporation
|
| std.h -- standard include file for DataViews
|
|=====================================================================
*/
#ifndef _STD_H_
#define _STD_H_
#include <stdio.h>
#include "dvenv.h"
#ifdef WINNT
#include <windows.h>
#endif
/* Only use function prototypes with ANSI C and C++ */
/* The V_P_ macro hides the function prototypes */
#if defined(ANSIFY) || (( defined(__STDC__) || defined(__cplusplus) ) && ! defined(_NO_PROTO))
# define V_P_(s) s
#else
# define V_P_(s) ()
#endif
#if defined (DV_DEV_COMP) && ( defined (__STDC__) || defined (__cplusplus) )
/* eliminate "used before initialized" messages from ansi c */
# define DV_INIT(a, b) (a) = (b)
/* eliminate "value computed is not used" messages from ansi c */
# define DV_ASSIGN(a, b) (a) = b
/* eliminate "defined but unused" messages from ansi c for SccsId */
# define VI_USE(var) static void * use_##var = (&use_##var, (void *) &var)
VI_USE (SccsId);
#else
# define DV_INIT(a, b)
# define DV_ASSIGN(a, b)
#endif /* __STDC__ */
#if ( defined(__STDC__) || defined(__cplusplus) ) && ! defined(_NO_PROTO)
#include <sys/types.h> /* for fd_set */
#ifdef WINNT
#include <time.h>
#else
#include <sys/time.h> /* for struct timeval */
#endif
#include <setjmp.h> /* for jmp_buf */
#endif
/* We don't want to include math.h with Visual C++ as it causes
* multiple link errors.
*/
#if ! defined(WINNT) || ! defined(__cplusplus)
#include <math.h>
#endif
#ifdef HAS_STRING_H
#include <string.h>
#endif
#ifdef HAS_STRINGS_H
#include <strings.h>
#endif
#if defined(__STDC__)
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#if defined(HAS_STDLIB)
#include <stdlib.h>
#endif
/* storage classes */
#define FAST register
#ifndef VMS
#if defined( WINNT ) && ( !defined( WINNT_NODVDLL) )
#define GLOBALDEF __declspec(dllexport)
#define GLOBALREF __declspec(dllimport)
#else
#define GLOBALDEF
#define GLOBALREF extern
#endif
#else
#define GLOBALDEF globaldef
#define GLOBALREF globalref
#endif
#define LOCAL static
#define CONST const
#ifndef VI
#define VI /* Declares functions to be internal VI routines */
#endif
/* Data types */
typedef char CHAR;
typedef char DV_BOOL;
typedef long BOOL_FUN;
typedef double DOUBLE;
typedef long LONG;
#ifdef HPUX_8 /* Get rid of existing define (from <sys/types.h>?) */
#undef FLOAT
#endif
typedef float FLOAT;
typedef int INT;
typedef int ENUM;
#define VOID void
typedef short SHORT;
#ifdef __STDC__
typedef char *ADDRESS; /* was void *ADDRESS; but this is too lenient */
#else
typedef char *ADDRESS;
#endif
#ifdef __STDC__
typedef int BOOLPARAM;
typedef int UBYTEPARAM;
#else
typedef DV_BOOL BOOLPARAM;
typedef int UBYTEPARAM;
#endif
typedef unsigned UNSIGNED;
typedef unsigned long ULONG;
typedef unsigned char UBYTE;
typedef unsigned short USHORT;
/* Function pointer types */
typedef char (*CHARFUNPTR)();
typedef short (*SHORTFUNPTR)();
typedef int (*INTFUNPTR)();
typedef LONG (*LONGFUNPTR)();
typedef ULONG (*ULONGFUNPTR)();
typedef VOID (*VOIDFUNPTR)();
#ifndef SCO
typedef BOOLPARAM (*BOOLFUNPTR)();
typedef ADDRESS (*ADDRFUNPTR)();
#else
typedef char (*BOOLFUNPTR)();
typedef char * (*ADDRFUNPTR)();
#endif
/* Constants */
#define STDIN (0)
#define STDOUT (1)
#define STDERR (2)
#define YES (1)
#define NO (0)
#define BUFSIZE (512)
#define BWRITE (-1)
#ifdef WINNT
#define READ_BIN "rb"
#else
#define READ_BIN "r"
#endif
#define READ_TEXT "r"
#define READ READ_BIN
#ifdef WINNT
#define WRITE_BIN "wb"
#else
#define WRITE_BIN "w"
#endif
#define WRITE_TEXT "w"
#define WRITE WRITE_TEXT
#define READ_WRITE "????"
#define APPEND "a"
#define BYTMASK (0377)
/* Macros */
#define FOREVER for (;;)
#ifndef DV_VIABS /* to be phased out */
#define DV_VIABS(x) ((x) < 0 ? -(x) : (x))
#endif
#ifndef ABS /* V.I. MACRO, not a function, like S_FABS, which is below */
#define ABS(x) ((x) < 0 ? -(x) : (x))
#endif
/* define macros to use instead of max and min */
#define S_MAX(x, y) (((x) < (y)) ? (y) : (x))
#define S_MIN(x, y) (((x) < (y)) ? (x) : (y))
/* Before we used to make our own ctype macros in case the system ones */
/* weren't defined. THIS IS NOW WRONG. Ctype macros (e.g. isprint, isalpha) */
/* (Our versions: S_ISPRINT, S_ISALPHA) are defined in dvctype.h */
/* VI's access to system routines */
/* Standard I/O */
#define S_FLUSHCHAR fflush(stdout)
#define S_FLUSHC fflush
#define S_FOPEN fopen
#define S_FCREATE fopen
#define S_FCLOSE fclose
#ifdef WINNT
#define S_POPEN _popen
#define S_PCLOSE _pclose
#else
#define S_POPEN popen
#define S_PCLOSE pclose
#endif
#if defined(MASSCOMP)
#define S_VFPRINTF VIvfprintf
#else
#define S_VFPRINTF vfprintf
#endif
#define S_GETCHAR getchar
#define S_PUTCHAR putchar
#define S_FGETC fgetc
#define S_GETC getc
#define S_UNGETC ungetc
#define S_FPUTC fputc
#define S_PUTC putc
#define S_SCANF scanf
#define S_FSCANF fscanf
#define S_SSCANF sscanf
#define S_PRINTF printf
#define S_FPRINTF fprintf
#define S_SPRINTF sprintf
#define S_FGETS fgets
#define S_GETS gets
#define S_FPUTS fputs
#define S_PUTS puts
#define S_FREAD fread
#ifdef INT_IS_16_BITS
# define S_FREADL VIfreadl
#else /* Int is 32 bits */
# define S_FREADL fread
#endif
#define S_SETBUF setbuf
#define S_FWRITE fwrite
#ifdef INT_IS_16_BITS
# define S_FWRITEL VIfwritel
#else /* Int is 32 bits */
# define S_FWRITEL fwrite
#endif
/* C Library Functions (and extensions) */
#define S_ATOI atoi
#define S_ATOL atol
#define S_ATOF atof
#ifdef DYNAGRAPHX
#define S_ALLOC XtMalloc
#define S_REALLOC XtRealloc
#define S_FREE XtFree
#else
#define S_ALLOC VUmalloc
#define S_REALLOC VUrealloc
#define S_FREE VUfree
#endif
#define S_EXIT VUexit
#define S_GETENV getenv
#define S_PUTENV putenv
#ifdef VMS
#define S_QSORT VIqsort
#else
#define S_QSORT qsort
#endif
#define S_SETJMP setjmp
#define S_LONGJMP longjmp
#define VI_SIGNAL signal
#define S_STRCAT strcat
#define S_STRCMP VIstrcmp
#define S_STRCPY strcpy
#define S_STRLEN strlen
#define S_STRTOL strtol
#define S_STRNCAT strncat
#define S_STRNCMP strncmp
#define S_STRNCPY strncpy
#define S_MEMCMP memcmp
#ifdef __STDC__
#define S_VA_PARAM va_alist
#define S_VA_DECL va_dcl
/* #define S_VA_PARAM ... */
/* #define S_VA_DECL */
#define S_VA_START(a,b) va_start(a,b)
#else
#define S_VA_PARAM va_alist
#define S_VA_DECL va_dcl
#define S_VA_START(a,b) va_start(a)
#endif
#if defined(SOLARIS) || defined(WINNT)
#define S_BCOPY(a,b,c) memcpy(b,a,c)
#define S_BZERO bzero
#else
#if defined(VMS)
#define S_BCOPY VIbcopy
#define S_BZERO VIbzero
#else
#define S_BCOPY bcopy
#define S_BZERO bzero
#endif
#endif
/* This is dependent on which system header file is used*/
#ifdef HAS_STRING_H
#define S_STR_INDEX strchr
#define S_STR_RINDEX strrchr
#else
#define S_STR_INDEX index
#define S_STR_RINDEX rindex
#endif
#define S_STRTOK strtok
#define S_SYSTEM system
/* System Calls */
#define S_OPEN open
#define S_CLOSE close
#define S_READ read
#define S_WRITE write
#ifndef VMS /* No equivalent on VMS. */
#define S_IOCTL ioctl
#endif
#define S_STAT stat
#define S_FSTAT fstat
#define S_GETCWD getcwd
#ifdef HAS_SELECT_FUNC
#define S_SELECT select
#endif
#define S_UNLINK unlink
/* Mathematical Functions */
#define S_ABS DV_VIABS
#define S_ATAN atan
#define S_ATAN2 atan2
#define S_CEIL ceil
#define S_COS cos
#define S_FABS fabs
#define S_FLOOR floor
#define S_LOG10 log10
#define S_POW pow
#define S_SIN sin
#define S_SQRT sqrt
#define S_TAN tan
/* FUNCTION DECLARATIONS--these collapse to standard C functions
* If you get "redeclaration" errors when linking, it is safe to
* comment out the appropriate function declaration.
*/
/* FUNCTION DECLARATIONS--these collapse to dataviews functions */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#if defined(SYSV) || defined(VMS) || defined(WINNT)
/* strtok is not in strings.h on the sun */
#ifdef _DLL
__declspec(dllimport) char *strtok V_P_((char *s1, const char *s2));
#else /* ndef _DLL */
char *strtok V_P_((char *s1, const char *s2));
#endif /* _DLL */
#endif
ADDRESS _CDECL VUmalloc V_P_(( LONG ));
ADDRESS _CDECL VUrealloc V_P_(( ADDRESS, LONG ));
VOID _CDECL VUfree V_P_(( ADDRESS ));
VOID _CDECL VUexit V_P_(( int ));
int _CDECL VIstrcmp V_P_(( char *, char * ));
#ifdef INT_IS_16_BITS
LONG _CDECL VIfreadl V_P_(( ADDRESS, int, LONG, FILE * ));
LONG _CDECL VIfwritel V_P_(( ADDRESS, int, LONG, FILE * ));
#endif
#ifdef VMS
int _CDECL VIbcopy V_P_(( char *, char *, int ));
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* Exit codes for calling S_EXIT() or return from main program */
#ifdef VMS
#define EXIT_OK 1
#define EXIT_ERR 2
#else
#define EXIT_OK 0
#define EXIT_ERR 1
#endif /* VMS */
/* The keywords "near" and "far" are defined out of existance for
| compilers that don't need memory models.
*/
#ifndef MEMORY_MODEL
#define near /* for near pointers */
#define far /* for far pointers */
#endif /* MEMORY_MODEL */
#ifdef DV_DEV_COMP
#include "vi/sysfuns.h"
#endif
/* Backward compatibility of upgraded typedefs and defines */
#ifdef DV_OLD_NAMES
#define abs DV_VIABS
#define BOOL DV_BOOL
#define BYTE char
#endif /* DV_OLD_NAMES */
#endif /* _STD_H_ */